3.7.76 \(\int (a+i a \tan (e+f x))^2 (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx\) [676]

Optimal. Leaf size=109 \[ \frac {2 a^2 (i A+B) (c-i c \tan (e+f x))^n}{f n}-\frac {a^2 (i A+3 B) (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}+\frac {a^2 B (c-i c \tan (e+f x))^{2+n}}{c^2 f (2+n)} \]

[Out]

2*a^2*(I*A+B)*(c-I*c*tan(f*x+e))^n/f/n-a^2*(I*A+3*B)*(c-I*c*tan(f*x+e))^(1+n)/c/f/(1+n)+a^2*B*(c-I*c*tan(f*x+e
))^(2+n)/c^2/f/(2+n)

________________________________________________________________________________________

Rubi [A]
time = 0.11, antiderivative size = 109, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.049, Rules used = {3669, 78} \begin {gather*} \frac {2 a^2 (B+i A) (c-i c \tan (e+f x))^n}{f n}-\frac {a^2 (3 B+i A) (c-i c \tan (e+f x))^{n+1}}{c f (n+1)}+\frac {a^2 B (c-i c \tan (e+f x))^{n+2}}{c^2 f (n+2)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(2*a^2*(I*A + B)*(c - I*c*Tan[e + f*x])^n)/(f*n) - (a^2*(I*A + 3*B)*(c - I*c*Tan[e + f*x])^(1 + n))/(c*f*(1 +
n)) + (a^2*B*(c - I*c*Tan[e + f*x])^(2 + n))/(c^2*f*(2 + n))

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int (a+i a \tan (e+f x))^2 (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx &=\frac {(a c) \text {Subst}\left (\int (a+i a x) (A+B x) (c-i c x)^{-1+n} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \left (2 a (A-i B) (c-i c x)^{-1+n}-\frac {a (A-3 i B) (c-i c x)^n}{c}-\frac {i a B (c-i c x)^{1+n}}{c^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {2 a^2 (i A+B) (c-i c \tan (e+f x))^n}{f n}-\frac {a^2 (i A+3 B) (c-i c \tan (e+f x))^{1+n}}{c f (1+n)}+\frac {a^2 B (c-i c \tan (e+f x))^{2+n}}{c^2 f (2+n)}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 2.66, size = 146, normalized size = 1.34 \begin {gather*} \frac {a^2 e^{n (-\log (c \sec (e+f x))+\log (c-i c \tan (e+f x)))} \sec ^2(e+f x) (c \sec (e+f x))^n \left ((2+n) (-B (-2+n)+i A (2+n))+\left (i A (2+n)^2+B \left (4+2 n+n^2\right )\right ) \cos (2 (e+f x))-n (A (2+n)-i B (4+n)) \sin (2 (e+f x))\right )}{2 f n (1+n) (2+n)} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + I*a*Tan[e + f*x])^2*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(a^2*E^(n*(-Log[c*Sec[e + f*x]] + Log[c - I*c*Tan[e + f*x]]))*Sec[e + f*x]^2*(c*Sec[e + f*x])^n*((2 + n)*(-(B*
(-2 + n)) + I*A*(2 + n)) + (I*A*(2 + n)^2 + B*(4 + 2*n + n^2))*Cos[2*(e + f*x)] - n*(A*(2 + n) - I*B*(4 + n))*
Sin[2*(e + f*x)]))/(2*f*n*(1 + n)*(2 + n))

________________________________________________________________________________________

Maple [A]
time = 1.49, size = 167, normalized size = 1.53

method result size
norman \(\frac {\left (i A \,a^{2} n^{2}+4 i A \,a^{2} n +4 i A \,a^{2}+a^{2} B n +4 a^{2} B \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f n \left (1+n \right ) \left (2+n \right )}-\frac {a^{2} B \left (\tan ^{2}\left (f x +e \right )\right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f \left (2+n \right )}-\frac {a^{2} \left (-i B n +A n -4 i B +2 A \right ) \tan \left (f x +e \right ) {\mathrm e}^{n \ln \left (c -i c \tan \left (f x +e \right )\right )}}{f \left (1+n \right ) \left (2+n \right )}\) \(167\)
risch \(\text {Expression too large to display}\) \(2499\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x,method=_RETURNVERBOSE)

[Out]

1/f/n/(1+n)*(I*A*a^2*n^2+4*I*A*a^2*n+4*I*A*a^2+a^2*B*n+4*a^2*B)/(2+n)*exp(n*ln(c-I*c*tan(f*x+e)))-a^2*B/f/(2+n
)*tan(f*x+e)^2*exp(n*ln(c-I*c*tan(f*x+e)))-a^2*(-I*B*n+A*n-4*I*B+2*A)/f/(1+n)/(2+n)*tan(f*x+e)*exp(n*ln(c-I*c*
tan(f*x+e)))

________________________________________________________________________________________

Maxima [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 689 vs. \(2 (102) = 204\).
time = 0.65, size = 689, normalized size = 6.32 \begin {gather*} \frac {2 \, {\left ({\left ({\left (A + i \, B\right )} a^{2} c^{n} n^{2} + 4 \, A a^{2} c^{n} n + 4 \, {\left (A - i \, B\right )} a^{2} c^{n}\right )} 2^{n} \cos \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) + {\left ({\left (A - i \, B\right )} a^{2} c^{n} n^{2} + 3 \, {\left (A - i \, B\right )} a^{2} c^{n} n + 2 \, {\left (A - i \, B\right )} a^{2} c^{n}\right )} 2^{n} \cos \left (-4 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 4 \, e\right ) + {\left ({\left (A + i \, B\right )} a^{2} c^{n} n + 2 \, {\left (A - i \, B\right )} a^{2} c^{n}\right )} 2^{n} \cos \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right ) - {\left ({\left (i \, A - B\right )} a^{2} c^{n} n^{2} + 4 i \, A a^{2} c^{n} n + 4 \, {\left (i \, A + B\right )} a^{2} c^{n}\right )} 2^{n} \sin \left (-2 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 2 \, e\right ) - {\left ({\left (i \, A + B\right )} a^{2} c^{n} n^{2} + 3 \, {\left (i \, A + B\right )} a^{2} c^{n} n + 2 \, {\left (i \, A + B\right )} a^{2} c^{n}\right )} 2^{n} \sin \left (-4 \, f x + n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right ) - 4 \, e\right ) - {\left ({\left (i \, A - B\right )} a^{2} c^{n} n + 2 \, {\left (i \, A + B\right )} a^{2} c^{n}\right )} 2^{n} \sin \left (n \arctan \left (\sin \left (2 \, f x + 2 \, e\right ), \cos \left (2 \, f x + 2 \, e\right ) + 1\right )\right )\right )}}{{\left ({\left (-i \, n^{3} - 3 i \, n^{2} - 2 i \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (4 \, f x + 4 \, e\right ) + {\left (n^{3} + 3 \, n^{2} + 2 \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (4 \, f x + 4 \, e\right ) + {\left (-i \, n^{3} - 3 i \, n^{2} - 2 \, {\left (i \, n^{3} + 3 i \, n^{2} + 2 i \, n\right )} \cos \left (2 \, f x + 2 \, e\right ) + 2 \, {\left (n^{3} + 3 \, n^{2} + 2 \, n\right )} \sin \left (2 \, f x + 2 \, e\right ) - 2 i \, n\right )} {\left (\cos \left (2 \, f x + 2 \, e\right )^{2} + \sin \left (2 \, f x + 2 \, e\right )^{2} + 2 \, \cos \left (2 \, f x + 2 \, e\right ) + 1\right )}^{\frac {1}{2} \, n}\right )} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")

[Out]

2*(((A + I*B)*a^2*c^n*n^2 + 4*A*a^2*c^n*n + 4*(A - I*B)*a^2*c^n)*2^n*cos(-2*f*x + n*arctan2(sin(2*f*x + 2*e),
cos(2*f*x + 2*e) + 1) - 2*e) + ((A - I*B)*a^2*c^n*n^2 + 3*(A - I*B)*a^2*c^n*n + 2*(A - I*B)*a^2*c^n)*2^n*cos(-
4*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 4*e) + ((A + I*B)*a^2*c^n*n + 2*(A - I*B)*a^2*c^n)
*2^n*cos(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1)) - ((I*A - B)*a^2*c^n*n^2 + 4*I*A*a^2*c^n*n + 4*(I*
A + B)*a^2*c^n)*2^n*sin(-2*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) + 1) - 2*e) - ((I*A + B)*a^2*c^n
*n^2 + 3*(I*A + B)*a^2*c^n*n + 2*(I*A + B)*a^2*c^n)*2^n*sin(-4*f*x + n*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2
*e) + 1) - 4*e) - ((I*A - B)*a^2*c^n*n + 2*(I*A + B)*a^2*c^n)*2^n*sin(n*arctan2(sin(2*f*x + 2*e), cos(2*f*x +
2*e) + 1)))/(((-I*n^3 - 3*I*n^2 - 2*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1
/2*n)*cos(4*f*x + 4*e) + (n^3 + 3*n^2 + 2*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1
)^(1/2*n)*sin(4*f*x + 4*e) + (-I*n^3 - 3*I*n^2 - 2*(I*n^3 + 3*I*n^2 + 2*I*n)*cos(2*f*x + 2*e) + 2*(n^3 + 3*n^2
 + 2*n)*sin(2*f*x + 2*e) - 2*I*n)*(cos(2*f*x + 2*e)^2 + sin(2*f*x + 2*e)^2 + 2*cos(2*f*x + 2*e) + 1)^(1/2*n))*
f)

________________________________________________________________________________________

Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 211 vs. \(2 (102) = 204\).
time = 4.97, size = 211, normalized size = 1.94 \begin {gather*} -\frac {2 \, {\left ({\left (-i \, A + B\right )} a^{2} n + 2 \, {\left (-i \, A - B\right )} a^{2} + {\left ({\left (-i \, A - B\right )} a^{2} n^{2} + 3 \, {\left (-i \, A - B\right )} a^{2} n + 2 \, {\left (-i \, A - B\right )} a^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left ({\left (-i \, A + B\right )} a^{2} n^{2} - 4 i \, A a^{2} n + 4 \, {\left (-i \, A - B\right )} a^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \left (\frac {2 \, c}{e^{\left (2 i \, f x + 2 i \, e\right )} + 1}\right )^{n}}{f n^{3} + 3 \, f n^{2} + 2 \, f n + {\left (f n^{3} + 3 \, f n^{2} + 2 \, f n\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (f n^{3} + 3 \, f n^{2} + 2 \, f n\right )} e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")

[Out]

-2*((-I*A + B)*a^2*n + 2*(-I*A - B)*a^2 + ((-I*A - B)*a^2*n^2 + 3*(-I*A - B)*a^2*n + 2*(-I*A - B)*a^2)*e^(4*I*
f*x + 4*I*e) + ((-I*A + B)*a^2*n^2 - 4*I*A*a^2*n + 4*(-I*A - B)*a^2)*e^(2*I*f*x + 2*I*e))*(2*c/(e^(2*I*f*x + 2
*I*e) + 1))^n/(f*n^3 + 3*f*n^2 + 2*f*n + (f*n^3 + 3*f*n^2 + 2*f*n)*e^(4*I*f*x + 4*I*e) + 2*(f*n^3 + 3*f*n^2 +
2*f*n)*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1482 vs. \(2 (87) = 174\).
time = 1.50, size = 1482, normalized size = 13.60 \begin {gather*} \begin {cases} x \left (A + B \tan {\left (e \right )}\right ) \left (i a \tan {\left (e \right )} + a\right )^{2} \left (- i c \tan {\left (e \right )} + c\right )^{n} & \text {for}\: f = 0 \\- \frac {2 A a^{2} \tan {\left (e + f x \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} - \frac {2 i B a^{2} f x \tan ^{2}{\left (e + f x \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} + \frac {4 B a^{2} f x \tan {\left (e + f x \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} + \frac {2 i B a^{2} f x}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} + \frac {B a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan ^{2}{\left (e + f x \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} + \frac {2 i B a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan {\left (e + f x \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} - \frac {B a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} + \frac {6 i B a^{2} \tan {\left (e + f x \right )}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} - \frac {4 B a^{2}}{2 c^{2} f \tan ^{2}{\left (e + f x \right )} + 4 i c^{2} f \tan {\left (e + f x \right )} - 2 c^{2} f} & \text {for}\: n = -2 \\- \frac {2 A a^{2} f x \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {2 i A a^{2} f x}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {i A a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} + \frac {A a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} + \frac {4 A a^{2}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} + \frac {6 i B a^{2} f x \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {6 B a^{2} f x}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {3 B a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )} \tan {\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {3 i B a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {2 i B a^{2} \tan ^{2}{\left (e + f x \right )}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} - \frac {6 i B a^{2}}{2 c f \tan {\left (e + f x \right )} + 2 i c f} & \text {for}\: n = -1 \\2 A a^{2} x + \frac {i A a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - \frac {A a^{2} \tan {\left (e + f x \right )}}{f} - 2 i B a^{2} x + \frac {B a^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - \frac {B a^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} + \frac {2 i B a^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: n = 0 \\- \frac {A a^{2} n^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan {\left (e + f x \right )}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {i A a^{2} n^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{3} + 3 f n^{2} + 2 f n} - \frac {2 A a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan {\left (e + f x \right )}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {4 i A a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {4 i A a^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{3} + 3 f n^{2} + 2 f n} - \frac {B a^{2} n^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan ^{2}{\left (e + f x \right )}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {i B a^{2} n^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan {\left (e + f x \right )}}{f n^{3} + 3 f n^{2} + 2 f n} - \frac {B a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan ^{2}{\left (e + f x \right )}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {4 i B a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n} \tan {\left (e + f x \right )}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {B a^{2} n \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{3} + 3 f n^{2} + 2 f n} + \frac {4 B a^{2} \left (- i c \tan {\left (e + f x \right )} + c\right )^{n}}{f n^{3} + 3 f n^{2} + 2 f n} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))**2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**n,x)

[Out]

Piecewise((x*(A + B*tan(e))*(I*a*tan(e) + a)**2*(-I*c*tan(e) + c)**n, Eq(f, 0)), (-2*A*a**2*tan(e + f*x)/(2*c*
*2*f*tan(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*f) - 2*I*B*a**2*f*x*tan(e + f*x)**2/(2*c**2*f*tan(e +
f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*f) + 4*B*a**2*f*x*tan(e + f*x)/(2*c**2*f*tan(e + f*x)**2 + 4*I*c**2
*f*tan(e + f*x) - 2*c**2*f) + 2*I*B*a**2*f*x/(2*c**2*f*tan(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*f) +
 B*a**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2/(2*c**2*f*tan(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*
f) + 2*I*B*a**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*c**2*f*tan(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*
c**2*f) - B*a**2*log(tan(e + f*x)**2 + 1)/(2*c**2*f*tan(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*f) + 6*
I*B*a**2*tan(e + f*x)/(2*c**2*f*tan(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*f) - 4*B*a**2/(2*c**2*f*tan
(e + f*x)**2 + 4*I*c**2*f*tan(e + f*x) - 2*c**2*f), Eq(n, -2)), (-2*A*a**2*f*x*tan(e + f*x)/(2*c*f*tan(e + f*x
) + 2*I*c*f) - 2*I*A*a**2*f*x/(2*c*f*tan(e + f*x) + 2*I*c*f) - I*A*a**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/
(2*c*f*tan(e + f*x) + 2*I*c*f) + A*a**2*log(tan(e + f*x)**2 + 1)/(2*c*f*tan(e + f*x) + 2*I*c*f) + 4*A*a**2/(2*
c*f*tan(e + f*x) + 2*I*c*f) + 6*I*B*a**2*f*x*tan(e + f*x)/(2*c*f*tan(e + f*x) + 2*I*c*f) - 6*B*a**2*f*x/(2*c*f
*tan(e + f*x) + 2*I*c*f) - 3*B*a**2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)/(2*c*f*tan(e + f*x) + 2*I*c*f) - 3*I
*B*a**2*log(tan(e + f*x)**2 + 1)/(2*c*f*tan(e + f*x) + 2*I*c*f) - 2*I*B*a**2*tan(e + f*x)**2/(2*c*f*tan(e + f*
x) + 2*I*c*f) - 6*I*B*a**2/(2*c*f*tan(e + f*x) + 2*I*c*f), Eq(n, -1)), (2*A*a**2*x + I*A*a**2*log(tan(e + f*x)
**2 + 1)/f - A*a**2*tan(e + f*x)/f - 2*I*B*a**2*x + B*a**2*log(tan(e + f*x)**2 + 1)/f - B*a**2*tan(e + f*x)**2
/(2*f) + 2*I*B*a**2*tan(e + f*x)/f, Eq(n, 0)), (-A*a**2*n**2*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)/(f*n**3 +
 3*f*n**2 + 2*f*n) + I*A*a**2*n**2*(-I*c*tan(e + f*x) + c)**n/(f*n**3 + 3*f*n**2 + 2*f*n) - 2*A*a**2*n*(-I*c*t
an(e + f*x) + c)**n*tan(e + f*x)/(f*n**3 + 3*f*n**2 + 2*f*n) + 4*I*A*a**2*n*(-I*c*tan(e + f*x) + c)**n/(f*n**3
 + 3*f*n**2 + 2*f*n) + 4*I*A*a**2*(-I*c*tan(e + f*x) + c)**n/(f*n**3 + 3*f*n**2 + 2*f*n) - B*a**2*n**2*(-I*c*t
an(e + f*x) + c)**n*tan(e + f*x)**2/(f*n**3 + 3*f*n**2 + 2*f*n) + I*B*a**2*n**2*(-I*c*tan(e + f*x) + c)**n*tan
(e + f*x)/(f*n**3 + 3*f*n**2 + 2*f*n) - B*a**2*n*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)**2/(f*n**3 + 3*f*n**2
 + 2*f*n) + 4*I*B*a**2*n*(-I*c*tan(e + f*x) + c)**n*tan(e + f*x)/(f*n**3 + 3*f*n**2 + 2*f*n) + B*a**2*n*(-I*c*
tan(e + f*x) + c)**n/(f*n**3 + 3*f*n**2 + 2*f*n) + 4*B*a**2*(-I*c*tan(e + f*x) + c)**n/(f*n**3 + 3*f*n**2 + 2*
f*n), True))

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+I*a*tan(f*x+e))^2*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((B*tan(f*x + e) + A)*(I*a*tan(f*x + e) + a)^2*(-I*c*tan(f*x + e) + c)^n, x)

________________________________________________________________________________________

Mupad [B]
time = 11.38, size = 193, normalized size = 1.77 \begin {gather*} -\frac {{\mathrm {e}}^{-e\,2{}\mathrm {i}-f\,x\,2{}\mathrm {i}}\,{\left (c-\frac {c\,\sin \left (e+f\,x\right )\,1{}\mathrm {i}}{\cos \left (e+f\,x\right )}\right )}^n\,\left (\frac {2\,a^2\,\left (2\,A-B\,2{}\mathrm {i}+A\,n+B\,n\,1{}\mathrm {i}\right )}{f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}+\frac {2\,a^2\,{\mathrm {e}}^{e\,4{}\mathrm {i}+f\,x\,4{}\mathrm {i}}\,\left (A-B\,1{}\mathrm {i}\right )\,\left (n^2+3\,n+2\right )}{f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}+\frac {2\,a^2\,{\mathrm {e}}^{e\,2{}\mathrm {i}+f\,x\,2{}\mathrm {i}}\,\left (n+2\right )\,\left (2\,A-B\,2{}\mathrm {i}+A\,n+B\,n\,1{}\mathrm {i}\right )}{f\,n\,\left (n^2\,1{}\mathrm {i}+n\,3{}\mathrm {i}+2{}\mathrm {i}\right )}\right )}{4\,{\cos \left (e+f\,x\right )}^2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^2*(c - c*tan(e + f*x)*1i)^n,x)

[Out]

-(exp(- e*2i - f*x*2i)*(c - (c*sin(e + f*x)*1i)/cos(e + f*x))^n*((2*a^2*(2*A - B*2i + A*n + B*n*1i))/(f*n*(n*3
i + n^2*1i + 2i)) + (2*a^2*exp(e*4i + f*x*4i)*(A - B*1i)*(3*n + n^2 + 2))/(f*n*(n*3i + n^2*1i + 2i)) + (2*a^2*
exp(e*2i + f*x*2i)*(n + 2)*(2*A - B*2i + A*n + B*n*1i))/(f*n*(n*3i + n^2*1i + 2i))))/(4*cos(e + f*x)^2)

________________________________________________________________________________________